import Taro from '@tarojs/taro'
import React, { useState } from 'react'
import './index.scss'

import { View, Text } from '@tarojs/components'
import CImage from '../CImage/index'

interface ICollegeMoreCard {
  data: {
    courseImg: string
    courseName: string
    courseSubtitle: string
    courseNumber: number
    courseTypeName: string
    price: number
  }
}
export default function CCollegeMoreCard(params: ICollegeMoreCard) {
  const storagesystem = Taro.getStorageSync('system')
  const [system] = useState(storagesystem)
  const { courseImg = '', price = 0, courseName = '', courseNumber = 0, courseTypeName = '', courseSubtitle } = params.data

  return (
    <View className='curriculumItem'>
      <View className='curriculumItemLeft'>
        <CImage src={courseImg}></CImage>
        <View className='priceNum'>{system.indexOf('iOS') < 0 ? (price > 0 ? '￥' + price : '免费') : '免费'}</View>
      </View>
      <View className='curriculumItemRight'>
        <Text className='itemTitle'>{courseName}</Text>
        <View style='fontSize:12px;marginTop:10px'>
          <Text className='curriculumNum'>{courseNumber}</Text>
          <Text>节课 | {courseTypeName}</Text>
        </View>
        <View className='context'>
          <Text>{courseSubtitle}</Text>
        </View>
      </View>
    </View>
  )
}
